#ifndef ENTROPY_H
#define ENTROPY_H

#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/timeb.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "chemnitz.h"

typedef /*@abstract@*/ struct
{
	uint8_t key [16];
	uint8_t state [BYTES_PER_BLOCK];
	uint16_t millitm;
	bool is_open;
} *CHEMNITZ_POOL;

/*@null@*/ CHEMNITZ_POOL chemnitz_pool_open (/*@unique@*/ uint8_t *key);
/*@falsewhennull@*/ bool chemnitz_pool_is_open (const CHEMNITZ_POOL pool) /*@*/;
void chemnitz_pool_put (CHEMNITZ_POOL pool, const uint64_t entropy) /*@modifies pool@*/;
uint64_t chemnitz_pool_get (CHEMNITZ_POOL pool) /*@modifies pool@*/;
void chemnitz_pool_close (/*@only@*/ /*@out@*/ /*@null@*/ CHEMNITZ_POOL pool);
int chemnitz_pool_serialize (CHEMNITZ_POOL pool, const char *path);
int chemnitz_pool_deserialize (/*@out@*/ CHEMNITZ_POOL pool, const char *path) /*@modifies pool@*/;

#endif

